package com.ihg.hiex.admin.dao.session;

import java.util.List;

import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;
import com.ihg.hiex.entity.session.Session;
import com.ihg.hiex.entity.session.during.SessionExercise;
import com.ihg.hiex.entity.user.Assessor;
import com.ihg.hiex.entity.user.Delegate;

/**
 * 
 * @author dan
 *
 */
@Dao("hibernate")
public interface SessionExerciseDao {
    
    /**
     * 
     * @param session
     * @return
     */
    @Query("FROM SessionExercise WHERE disabled = false AND session = :session")
    public List<SessionExercise> list(@Variable("session") Session session);
    
    
    /**
     * 
     * @param session
     * @param delegate
     * @return
     */
    @Query("FROM SessionExercise WHERE disabled = false AND session = :session AND delegate = :delegate")
    public List<SessionExercise> list(@Variable("session") Session session, @Variable("delegate") Delegate delegate);
    
    /**
     * @param session
     * @param delegate
     * @param names
     * @return
     */
    @Query("FROM SessionExercise WHERE disabled = false AND session = :session AND delegate = :delegate AND name IN (:names)")
    public List<SessionExercise> list(@Variable("session") Session session, @Variable("delegate") Delegate delegate, @Variable("names") List<String> names);
    
    /**
     * 
     * @param session
     * @param assessor
     * @param delegate
     * @param name
     * @return
     */
    @Query("FROM SessionExercise WHERE disabled = false AND session = :session AND assessor = :assessor AND delegate = :delegate AND name = :name")
    public SessionExercise load(@Variable("session") Session session, @Variable("assessor") Assessor assessor, @Variable("delegate") Delegate delegate, @Variable("name") String name);

}
